import 'package:aichat_flutter_wallet/module/module_browser/widget/common_widget.dart';
import 'package:aichat_flutter_wallet/module_common/utils/colors.dart';
import 'package:aichat_flutter_wallet/module_common/widgets/button/bottom_button.dart';
import 'package:aichat_flutter_wallet/module_common/widgets/dialog/bottom_sheet_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class TransferAllAuthorizationWidget extends StatefulWidget {
  const TransferAllAuthorizationWidget({super.key});

  @override
  State<TransferAllAuthorizationWidget> createState() => _TransferAllAuthorizationWidgetState();
}

class _TransferAllAuthorizationWidgetState extends State<TransferAllAuthorizationWidget> {
  @override
  Widget build(BuildContext context) {
    return BottomSheetWidget(
      expand: false,
      title: 'Transfer Authorization',
      child: Padding(
        padding: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.w),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            CommonWidgetUtil.websizeWidget(title: 'Dmail Network', subTitle: 'https://dmail.ai/'),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.textWidget(
                'Attention! Granting this permission will give the contract access to transfer your %XXX% If this contract is malicious, there is a risk of theft. Please ensure that the current connection is trustworthy!',
                color: AppColors.c_868391,
                fontsize: 12.sp),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.contentItemWidget('From', Text('0x1gfq…..aaas')),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.contentItemWidget('To', Text('0x1gfq…..aaas')),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.contentItemWidget('Contract Address', Text('0x1gfq…..aaas')),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.contentItemWidget('Gas Fee', Text("0.01ETH(\$16.54)")),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.contentItemWidget('Contract Method', Text('Commit')),
            SizedBox(
              height: 20.w,
            ),
            Text(
              'Authorization Amount',
              style: TextStyle(color: AppColors.c_333333, fontSize: 14.sp, fontWeight: FontWeight.w600),
            ),
            SizedBox(
              height: 10.w,
            ),
            CommonWidgetUtil.tokenInputWidget(
                canInput: false,
                onChange: (value) {
                }),
            SizedBox(
              height: 20.w,
            ),
            Container(
              width: double.infinity,
              padding: EdgeInsets.all(12.w),
              decoration: BoxDecoration(color: AppColors.c_FFF8F1, borderRadius: BorderRadius.circular(10)),
              child: Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
                Image.asset(
                  'assets/images/dapp/warn.png',
                  width: 20.w,
                  height: 20.w,
                ),
                SizedBox(
                  width: 7.w,
                ),
                Expanded(
                    child: CommonWidgetUtil.textWidget(
                        'The amount you have authorized is infinite. This operation allows the third party to spend all of your token balance until reaching the spending limit or revoking it. Please consider this carefully',
                        fontsize: 12.sp,
                        color: AppColors.c_FF5100))
              ]),
            ),
            SizedBox(
              height: 10.w,
            ),
            BottomBtn(
              textList: ['Cancel', 'Confirm'],
              onConfirm: () {
              },
              onCancel: () {
              },
            )
          ],
        ),
      ),
    );
  }
}
